package com.medical.view.wicket.form;

import java.util.Date;

import org.apache.wicket.markup.ComponentTag;
import org.apache.wicket.markup.html.form.TextField;
import org.apache.wicket.model.IModel;
import org.apache.wicket.validation.IValidatable;
import org.apache.wicket.validation.validator.AbstractValidator;
import org.apache.wicket.validation.validator.RangeValidator;

public class MedTelephoneField extends MedNumberField {

	public MedTelephoneField(String id) {
		super(id);
		add(MedTelephoneValidatable.getInstance());
//		add(new RangeValidator(0000,))
	}
	public MedTelephoneField(final String id, final IModel  model)
	{
		super(id, model);
		add(MedTelephoneValidatable.getInstance());
		 
	}
}

// @Override
// protected void onComponentTag(final ComponentTag tag)
// {
//	
//		
// // Default handling for component tag
// super.onComponentTag(tag);
// if(getValue().equals("0")){
// tag.remove("value");
// }
//
// }

class MedTelephoneValidatable extends AbstractValidator {
	private static final MedTelephoneValidatable INSTANCE = new MedTelephoneValidatable();

	public static MedTelephoneValidatable getInstance() {
		return INSTANCE;
	}

	@Override
	protected void onValidate(IValidatable validatable) {

		System.out.println(validatable.getValue());
	}

}
